package com.example.springboot.utils;

import lombok.Data;

@Data
public class ResponseResult<T> {
    private String message;
    private Integer code;
    private T data;

    public static<T> ResponseResult<T> success(T data) {
        ResponseResult<T> result = new ResponseResult();
        result.setMessage("success");
        result.setCode(200);
        result.setData(data);
        return result;
    }

    public static<T> ResponseResult<T> fail(String message) {
        ResponseResult<T> result = new ResponseResult();
        result.setCode(400);
        result.setMessage(message);
        return result;
    }
}
